package com.woorigil.social.controller.admin;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import com.woorigil.social.controller.BaseController;
import com.woorigil.social.domain.stats.StatsService;

@Controller
public class StatsController extends BaseController {
	@Autowired StatsService statsService;
	
	@RequestMapping("/admin/stats/main")
	public ModelAndView main(@RequestParam(defaultValue="14") int days) {
		ModelAndView mav = new ModelAndView(getForwordPage("admin/stats/main"));
		mav.addObject("actionStatsByDay", statsService.getActionStats(days));
		mav.addObject("actionStatsByTime", statsService.getActionStatsByTime(3));
		return mav;
	}
}
